use std::collections::HashSet;

struct Solution {}

fn main() {}

impl Solution {
    pub fn find_matrix(nums: Vec<i32>) -> Vec<Vec<i32>> {
        let mut ret:Vec<Vec<i32>> = vec![];
        nums.iter().for_each(|&x| { Self::add_one_num(&x, &mut ret); });
        ret
    }

    pub fn add_one_num(num: &i32, ret: &mut Vec<Vec<i32>>) {
        for row in ret.iter_mut() {
            if !row.contains(&num) {
                row.push(*num);
                return;
            }
        }
        ret.push(vec![*num]);
    }
}